<?php

class wms_finder_orderform
{

	var $column_edit = '操作';
	var $column_edit_width = "50";

    var $detail_orderform_delis = "发货单明细";
    //var $detail_orderform_ax = "AX订单详情";
	//public function column_edit($row)
	//{
	//	$finder_id = $_GET['_finder']['finder_id'];
	//	return '<a href="index.php?app=wms&ctl=admin_orderform&act=editOrderform&id=' . $row['id'] . '&finder_id='.$finder_id.'" target="_blank">编辑</a>';
	//}

    /*
     * 备货通知单明细
     */
    function detail_orderform_delis($row)
    {
        $render = app::get('wms')->render();
        // $dlyObj = app::get('wms')->model('delivery');
        // $omeExtOrdLib = kernel::single('ome_extint_order');

        // $orderform_delis = app::get('wms')->model('orderform_delis');
        // $basicMaterialInfo = $orderform_delis->getList('*', array('orderform_id' => $row));
        // foreach ($basicMaterialInfo as $key => $value) {
        //     $dly = $dlyObj->dump($value['delivery_id'],'outer_delivery_bn');
        //     $order_bns = $omeExtOrdLib->getOrderBns($dly['outer_delivery_bn']);
        //     $order_bn = array_values($order_bns);
        //     $basicMaterialInfo[$key]['order_bn'] = $order_bn[0];
        // }

        $sql="SELECT e.delivery_bn,os.order_bn,f.AXCustomer,f.customername from  sdb_wms_delivery e 
         inner join sdb_ome_shop f on e.shop_id = f.shop_id
         inner JOIN sdb_ome_delivery od on ( e.outer_delivery_bn = od.delivery_bn )
         inner JOIN sdb_ome_delivery_order odo on ( od.delivery_id = odo.delivery_id )
         inner JOIN sdb_ome_orders os on (odo.order_id = os.order_id)
         inner join sdb_wms_orderform_delis deli on e.delivery_id=deli.delivery_id where deli.orderform_id=".$row;
        
        $db=kernel::database();
        $basicMaterialInfo=$db->select($sql);   

        $render->pagedata['res'] = $basicMaterialInfo;
        return $render->fetch('admin/orderform/orderform_delis.html');
    }

    /*
     * 备货通知单明细
     */
    // function detail_orderform_ax($row){
    //     $render = app::get('wms')->render();
    //     $orderform_delis = app::get('wms')->model('orderform_delis');
    //     $basicMaterialInfo = $orderform_delis->getList('*', array('orderform_id' => $row));
    //     $render->pagedata['res'] = $basicMaterialInfo;
    //     return $render->fetch('admin/orderform/orderform_ax.html');
    // }
}